package com.app.megaprosoft.modyimcarcare;

import com.megaprosoft.modyimcarcare.R;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class CarCare_Adapter_Item extends BaseAdapter 
{
    private Context context;
    private String[][] lis;
    
    public CarCare_Adapter_Item(Context c, String[][] li) 
    {

    	// TODO Auto-generated method stub
        context = c;
        lis = li;
    }
    public int getCount() {
    	// TODO Auto-generated method stub
    	try{
    		 return lis.length;
		}catch(Exception e){
			return 0;
		}
       
    }

    public Object getItem(int position) {
    	// TODO Auto-generated method stub
        return position;
    }

    public long getItemId(int position) {
    	// TODO Auto-generated method stub
        return position;
    }
    
    
	public View getView(int position, View convertView, ViewGroup parent) {
		// TODO Auto-generated method stub
		
		LayoutInflater inflater = (LayoutInflater) context
				.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
	 
		if (convertView == null) {
			convertView = inflater.inflate(R.layout.list_item, null); 
		}
				
		// ColPhoto
//		String strPath = "/mnt/sdcard/contact/"+lis[position][3].toString();
//		ImageView imgPhoto = (ImageView) convertView.findViewById(R.id.ColPhoto);
//		imgPhoto.setPadding(5, 5, 5, 5);
//		Bitmap bm = BitmapFactory.decodeFile(strPath);
////		Bitmap bm = BitmapFactory.decodeResource(R.drawable.carcare_logo);
//		int width=100;
//	    int height=100;
//	    Bitmap resizedbitmap = Bitmap.createScaledBitmap(bm, width, height, true);
//	    imgPhoto.setImageBitmap(resizedbitmap);
		
		// ColName
		TextView txtName = (TextView) convertView.findViewById(R.id.ColName);
		txtName.setPadding(0, 0, 0, 0);
		txtName.setText(lis[position][2].toString());
		
		// ColPrice
		TextView txtEmail = (TextView) convertView.findViewById(R.id.Colprice);
		txtEmail.setPadding(0, 0, 0, 0);
//		Double __val = Double.valueOf(lis[position][48]);
//		txtEmail.setText(String.valueOf(__val));
		txtEmail.setText(lis[position][48].toString());
		return convertView;
	}
} 